<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description("Test the parsing of the cursor property in quirks mode.");
function makeCursorRule(rule)
{
    return "cursor: " + rule + ";";
}

function testCursorRule(rule, expected)
{
    var cssText = makeCursorRule(rule);
    if (typeof expected == 'undefined')
        expected = cssText;
    else
        expected = makeCursorRule(expected);
    shouldBeEqualToString('roundtripCssRule("' + cssText + '")', expected);
}

function testInvalidCursorRule(rule)
{
    shouldBeEqualToString('roundtripCssRule("' + makeCursorRule(rule) + '")', '');
}

function roundtripCssRule(cssText)
{
    var div = document.createElement("div");
    div.setAttribute("style", cssText);
    document.body.appendChild(div);
    var result = div.style.cssText;
    document.body.removeChild(div);
    return result;
}

debug('Test cursor rules which should accept \'hand\' as an alias of \'pointer\'.');
testCursorRule('hand', 'pointer');
testCursorRule('url(file:///foo.png), hand', 'url("file:///foo.png"), pointer');

debug('');
debug('Test invalid cursor rules which shouldn\'t parse at all.');
testInvalidCursorRule('url(file:///foo.png), url(file:///foo2.png)');

successfullyParsed = true;
</script>
</body>
</html>
